const mongoose = require("mongoose");
//数据库连接地址+数据库名称（system）
const DBURL='mongodb://127.0.0.1:27017/system'
//连接数据库
mongoose.connect(DBURL).then(res=>{
    console.log('连接成功')
 }).catch(e=>{
    console.log('连接失败')
 })
 mongoose.connection.on('connected',()=>{
    console.log('数据库连接成功')
})
mongoose.connection.on('error',err=>{
    console.log('数据库连接失败')
})
const userSchema = new Schema({
    name: String,
    age: Number,
    email: String
  }); 
const User = mongoose.model('User', userSchema);

